package com.caocaog.market.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.caocaog.market.dms.vo.QueryOrderVo;
import com.caocaog.market.entity.*;
import com.caocaog.market.pay.syb.dto.SybDto;
import com.caocaog.market.toccpt.vo.CcptOrderInfo;
import com.caocaog.market.vo.*;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 商品订单信息表
 *
 * @author jeecg-boot
 * @date 2021-11-29
 */
public interface IOrderBaseService extends IService<OrderBase> {

    OrderBase selectOrderInfo(String orderId);

    OrderBase selectOrderInfoByOrderNo(String orderNo);

    IPage<OrderBase> selectOrderListForMember(OrderBase orderBase, Integer pageNo, Integer pageSize);

    IPage<OrderBase> selectOrderListForMerchant(OrderBase orderBase, Integer pageNo, Integer pageSize);

    //单商品订单
    Result add(OrderForOneVo vo, Member member);

    Result getSumPrice(OrderForOneVo vo);

    //获取配送费
    DistanceVo getDeliveryAmount(DistanceVo vo);

    //周边好物 周边店铺推荐
    Result goodThingsAround(String siteId, int type, String lat, String lng);

    //送大侠 首页-周边好物
    Result goodThingsAroundForSDX(String lat, String lng, Integer pageNo, Integer pageSize);

    //支付回调订单状态 结算记录
    void localHandler(String payNo);

    //取消订单
    Result cancelOrder(OrderBase orderBase, Member member);

    //核销订单
    Result verifyOrder(OrderBase orderBase);

    //订单申请退款
    Result refundOrder(OrderRefund orderRefund, Member member, OrderBase orderBase);

    Result getShopInfo(ShopInfoVo shopInfoVo);

    Page getShopOfGoodsList(GoodsBasic goodsBasic, Integer pageNo, Integer pageSize);

    Result updOrderIsShow(String orderId);

    //首页店铺推荐
    ShopVo DayRecommend(String siteId);

    /**
     * 计算符合的优惠信息
     *
     * @author chechen
     * @date 2021-12-19
     */
    List<ShopPromoHis> computeConformPromo(OrderForOneVo orderForOneVo);

    List<OrderStatusInfo> getOrderStatusInfo(String orderId);

    void addOrderStatusInfo(String orderId, String orderNo, String createBy, String remark, String statusName, Date date);

    CcptOrderInfo getCcptOrderInfo(OrderBase orderBase);

    QueryOrderVo queryOrderVo(String orderNo, String shopId);

    void testPrint(String orderNo);

    /**
     * 根据跑腿6.0 sid 获取订单商品信息
     */
    List<OrderLine> getOrderLineByCcptOrderSid(Integer ccptOrderSid);

    /**
     * 根据跑腿6.0 sid 获取订单餐号
     */
    Integer getMealNumberByCcptOrderSid(Integer ccptOrderSid);


    //首页统计
    Map orderCount(String id, LoginUser userType);

    /**
     * 订单发货操作
     *
     * @param orderShippedVO 发货信息
     * @return 发货结果
     */
    Result<?> orderShipped(OrderShippedVO orderShippedVO);

    /**
     * 订单后台完成
     *
     * @param orderId 订单ID
     * @return 完成订单
     */
    Result<?> orderCompletion(String orderId);

    /**
     * 构建这个订单的微信支付信息
     * @param orderBase 订单基础信息
     * @param sybDto 支付DTO
     */
    void buildThisOrderMerchantPay(OrderBase orderBase, SybDto sybDto);
}
